/* ==================================
	Main
 ================================== */
package it.unibo.iss.domoticaContact;
import it.unibo.platform.expert.SubjectNameService;
import it.unibo.is.common.IS09Util;
import it.unibo.iss.domotica.EDDomain.Transmitter;
import it.unibo.platform.lindaLike.LindaLike;

public  class DomoticaContact{

private Transmitter transmitter;
	
	public void doJob(){
		init();
		configure();
		start();
	}

	protected void init(){
   	//Properties used by the system  (TODO)
 	//System.setProperty("observeSpace", "unset");	//automatically set by selectInput
  
  	//Properties to show the internal behavior 
  		System.setProperty("coreTrace", "unset");
		System.setProperty("medclTrace", "unset");
		System.setProperty("obsTrace", "unset");
		System.setProperty("udpTrace", "unset");
		System.setProperty("tcpTrace", "unset");
		System.setProperty("httpTrace", "unset");
		initSupport();
	}

	protected void initSupport(){
		IS09Util.init();
		((LindaLike)LindaLike.getSpace()).clean();
		SubjectNameService.init();
	}
	protected void configure(){
	/* TODO
	* Define an application observer 
	* that auto-register itself in the shared space
	*/
// 	new ApplicationInputSpaceObserver( );	//once created, it observes the shared space

	

	SubjectNameService.addSubject( "TCP", "receiver", "consumptionData", "127.0.0.1", 9070 );  

//		transmitter = new Transmitter();
//		transmitter.setName("transmitter");
 	}

	protected void start(){
		transmitter.start();
 	}
	
 	public static void main(String args[]) throws Exception {
		DomoticaContact system = new DomoticaContact( );
		system.doJob();
	}
	
}//domoticaContact
